function dt = multiDcm(DIR)

% Reads multiple dcm files from DIR into s ingle structure
% if a second input argument is provided it assumes it is the file where
% the JSON object describing dt is to be created.
%
%Example:
%
% dt = multiDcm('HUTCHESON_NATHAN/IM-0001*.dcm')
%
%Jonas ALmeida April 2012

d = dir(DIR);

if length(d)==0
    error([DIR,' has no content']);
end

k = strfind(DIR,'/');
if length(k)>0
    k=k(end);
    DIR0=DIR(1:k);
    DIR1=DIR(k+1:end);
else
    DIR0='';
end



for i=1:length(d)
    disp([DIR0,d(i).name]);
    dt.im{i}=dicomread([DIR0,d(i).name]);
end



